import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 导入按需导入插件
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from "node:path";

export default defineConfig({
  plugins: [
    vue(),
    // 配置自动导入
    AutoImport({
      resolvers: [ElementPlusResolver()], // 自动导入 Element Plus 相关函数
    }),
    // 配置组件自动导入
    Components({
      resolvers: [ElementPlusResolver()], // 自动导入 Element Plus 组件
    }),
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  }
})